
<template>
    <div>
        <el-form :inline="true" :model="formInline" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
           <!-- 法人名称-->
            <el-form-item :label="nowLangue.judName " class="selectMB10">
                <el-input size="mini" disabled v-if="legalPersonLists.length==1" v-model="formInline.legalPersonName" ></el-input>
                <el-select size="mini"  clearable v-model="formInline.legalPersonCode" v-else :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(legalPerson,index) in legalPersonLists" :key="index" :label="legalPerson.legalPersonCode" :value="legalPerson.legalPersonName">
                    </el-option>
                </el-select>
            </el-form-item>
           <!-- 检验商名称-->
            <el-form-item :label="nowLangue.surveyorName" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--出库库房-->
            <el-form-item :label="nowLangue.outWareHouse" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--出库库区-->
            <el-form-item :label="nowLangue.outWareArea" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--制单时间-->
            <div class="dayChose">
                <el-form-item :label="nowLangue.createCodeTime" class="selectMB10" >
                    <el-date-picker type="date" :editable="false" v-model="formInline.startCreateTime" clearable :placeholder="nowLangue.pleaseSelect" @change="selectedCreateTimeBegin"></el-date-picker>
                </el-form-item>
                <span v-text="nowLangue.to"></span>
                <el-form-item  class="selectMB10" style="margin-right:20px;">
                    <el-date-picker clearable :editable="false" v-model="formInline.endCreateTime"  type="date" :placeholder="nowLangue.pleaseSelect" @change="selectedCreateTimeEnd"></el-date-picker>
                </el-form-item>
            </div>
            <!--入库库房-->
            <el-form-item :label="nowLangue.inWareHouse" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--入库库区-->
            <el-form-item :label="nowLangue.inWareArea" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--状态-->
            <el-form-item :label="nowLangue.status" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--单据类型-->
            <el-form-item :label="nowLangue.billType" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--检验借出申请单号-->
            <el-form-item :label="nowLangue.testLendApplyCode" class="selectMB10">
                <el-input size="mini" v-model="formInline.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.testLendApplyCode"></el-input>
            </el-form-item>
            <el-form-item class="selectMB10">
                <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" type="danger" @click="queryClick()" v-text="nowLangue.query"></el-button>
            </el-form-item>
        </el-form>
        <!--表格-->
        <label class="default-label" v-text="nowLangue.testOutWareApplyDetail"></label>
        <el-table :data="testApplyData" border style="width: 100%;" v-loading.body="loading" :element-loading-text="nowLangue.loadDesperately">
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
            <!--操作-->
            <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="150">
                <template scope="scope">
                    <button class="operationItem bolder" @click="update(scope.$index,scope.row)" v-text="nowLangue.update"></button>
                    <button class="operationItem bolder" @click="toExam" v-text="nowLangue.exam"><!--审核--></button>
                    <button class="operationItem bolder" v-if="scope.row.status" @click="toExam" v-text="nowLangue.hangUp"><!--挂起--></button>
                    <button class="operationItem bolder" v-else @click="toExam" v-text="nowLangue.goOn"><!--继续--></button>
                    <button class="operationItem bolder" @click="check" v-text="nowLangue.check"><!--查看--></button>
                </template>
            </el-table-column>
            <!--检验借出申请单号-->
            <el-table-column prop="" :label="nowLangue.testLendApplyCode" header-align="center" show-overflow-tooltip></el-table-column>
            <!--检验类型-->
            <el-table-column prop="" :label="nowLangue.testType" header-align="center" show-overflow-tooltip></el-table-column>
            <!--状态-->
            <el-table-column prop="" :label="nowLangue.status" header-align="center" show-overflow-tooltip></el-table-column>
            <!--备件总数量-->
            <el-table-column prop="" :label="nowLangue.spareSumNum" header-align="center" show-overflow-tooltip></el-table-column>
            <!--处置意见-->
            <el-table-column prop="" :label="nowLangue.managerIdea" header-align="center" show-overflow-tooltip></el-table-column>
            <!--入库库房-->
            <el-table-column prop="" :label="nowLangue.inWareHouse" header-align="center" show-overflow-tooltip></el-table-column>
            <!--入库库区-->
            <el-table-column prop="" :label="nowLangue.inWareArea" header-align="center" show-overflow-tooltip></el-table-column>
            <!--出库库房-->
            <el-table-column prop="" :label="nowLangue.outWareHouse" header-align="center" show-overflow-tooltip></el-table-column>
            <!--出库库区-->
            <el-table-column prop="" :label="nowLangue.outWareArea" header-align="center" show-overflow-tooltip></el-table-column>
            <!--制单人-->
            <el-table-column prop="" :label="nowLangue.createCoder" header-align="center" show-overflow-tooltip></el-table-column>
            <!--制单时间-->
            <el-table-column prop="" :label="nowLangue.createCodeTime" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                nowLangue:{},
                languageScoped:{
                    zh:{
                        "pleaseSelect":"请选择",
                        "pleaseImport":"请输入",
                        "surveyorName":"检验商名称",
                        "judName":"法人名称",
                        "outWareHouse":"出库库房",
                        "outWareArea":"出库库区",
                        "createCoder":"制单人",
                        "createCodeTime":"制单时间",
                        "inWareHouse":"入库库房",
                        "inWareArea":"入库库区",
                        "status":"状态",
                        "billType":"单据类型",
                        "testLendApplyCode":"检验借出申请单号",
                        "testType":"检验类型",
                        "spareSumNum":"备件总数量",
                        "managerIdea":"处置意见",
                        "loadDesperately":"拼命加载中",
                        "sequence":"序",
                        "operate":"操作",
                        "query":"查询",
                        "to":"至",
                        "testOutWareApplyDetail":"检验出库申请明细",
                        "update":"修改",
                        "exam":"审核",
                        "check":"查看",
                        "hangUp":"挂起",
                        "goOn":"继续",
                    },
                    en:{
                        "pleaseSelect":"pleaseSelect",
                        "pleaseImport":"pleaseImport",
                        "surveyorName":"surveyorName",
                        "judName":"judName",
                        "outWareHouse":"outWareHouse",
                        "outWareArea":"outWareArea",
                        "createCoder":"createCoder",
                        "createCodeTime":"createCodeTime",
                        "inWareHouse":"inWareHouse",
                        "inWareArea":"inWareArea",
                        "status":"status",
                        "billType":"billType",
                        "testLendApplyCode":"testLendApplyCode",
                        "testType":"testType",
                        "spareSumNum":"spareSumNum",
                        "managerIdea":"managerIdea",
                        "loadDesperately":"loadDesperately",
                        "sequence":"sequence",
                        "operate":"operate",
                        "query":"query",
                        "to":"to",
                        "testOutWareApplyDetail":"testOutWareApplyDetail",
                        "update":"update",
                        "exam":"exam",
                        "check":"check",
                        "hangUp":"hangUp",
                        "goOn":"goOn",
                    }
                },
                // 查询表单
                formInline:{
                    legalPersonId:'',
                    legalPersonCode:"",
                    legalPersonName:'',
                },
                legalPersonLists:[],//法人名称列表
                legalPersonDropDown:[], //法人名称
                testApplyData:[{
                    name:"111"
                }],//检验出库申请明细
                //查询禁用
                selectDisabled:false,

                loading:false,
            };
        },
        created:function(){
            this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
        },
        computed:{
            languageType(){
                return this.$store.state.languageType;
            }
        },
        watch:{
            languageType(){
                this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
            }
        },
        //进入页面立即运行此方法
        mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'TestLend');
        },
        methods:{
            // 选择创建开始日期
            selectedCreateTimeBegin(val){

            },
            // 选择创建结束日期
            selectedCreateTimeEnd(val){

            },
            // 查询法人名称
            legalPersonDropDownValue(){  //法人名称下拉列表值
                var _this = this;
                $.ajax({
                    type:'GET',
                    url:_this.procurement_service+"legalPerson/ofCurrentUser",
                    cache:false,
                    success:function(data){
                        if(data.success){
                            _this.legalPersonLists = data.data;
                            if(_this.legalPersonLists.length == 1){
                                _this.formInline.legalPersonId =_this.legalPersonLists[0].id;
                                _this.formInline.legalPersonCode =_this.legalPersonLists[0].legalPersonCode;
                                _this.formInline.legalPersonName =_this.legalPersonLists[0].legalPersonName;
                            }
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            //下拉框公共接口
           /* getCommonList(){
                var _this=this;
                var tmp=["substituteForm.productLine","substituteForm.status"];
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"metadata/getPullDownList",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.productLineList=data.data['substituteForm.productLine'];//产品线集合
                            _this.statusList=data.data['substituteForm.status'];//状态集合
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },*/
            //查询列表
            queryClick(){
                /*var _this=this;
                 _this.loading=true;
                 var urlAddress="";
                 if(this.isClickBySelect){
                     urlAddress="projectSubstitute/queryMaterialByPage";
                 }else{
                     urlAddress="projectSubstitute/queryIncreasementMaterialByPage";
                 }
                 var tmp={
                     productLineId:_this.formInline.productLineId,
                     legalPersonCode:_this.formInline.legalPersonCode,
                     startCreateTime:_this.formInline.startCreateTime,
                     endCreateTime:_this.formInline.endCreateTime,
                     materialCode:_this.formInline.materialCode,
                     materialName:_this.formInline.materialName,
                     status:_this.formInline.status,
                     pageIndex:_this.pageIndex,
                     pageSize:_this.pageSize
                 };
                 $.ajax({
                     type: 'POST',
                     url: _this.metadata_service+urlAddress,
                     cache: false,
                     data:JSON.stringify(tmp),
                     dataType:'JSON',
                     contentType: "application/json;charset=utf-8",
                     success: function (data) {
                         if (data.success) {
                             _this.loading=false;
                             _this.isPaging=true;
                             _this.totalPage=data.data.totalPage;
                             _this.totalNumber=data.data.totalNumber;
                             _this.productData=data.data.dataList;
                         }else{
                             _this.loading=false;
                            _this.common.errorTip(data.errorMessage)
                         }
                     }
                 });*/
            },
            //修改
            update(){
                this.$router.push({ path: 'updateTeLeReturn', query: { }});
            },
            exam(){
                this.$router.push({ path: 'RmcOutApply', query: { }});
            },
        }
    }
</script>



